
package com.lpf.transaction.dao;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

@Slf4j
@Repository
public class UserDao {

    @Autowired
    private JdbcTemplate jdbcTemplate;

    public void add(String name, Integer age) {

        String sql = "INSERT INTO users(NAME, age) VALUES(?,?);";
        int update = jdbcTemplate.update(sql, name, age);

        log.error("数据库添加user成功：" + update);
    }
}
